<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/vue-2.4.0.js"></script>
    <script src="lib/vue-router-3.0.1.js"></script>
    <style>
        .router-link-active{
            color: red;
            font-weight: 800;
            font-style: italic;
            font-size: 80px;
            text-decoration: underline;
            background-color: green;
        }
        .myactive{
            color: red;
            font-weight: 800;
            font-style: italic;
            font-size: 80px;
            text-decoration: underline;
            background-color: green;
        }

        .v-enter,.v-leave-to{
            opacity: 0;
            transform: translate(140px);
        }
        .v-enter-active,.v-leave-active{
            transition: all 0.3s;
        }
    </style>
</head>
<body>
<div id="app">
    <a href="#/login">登录</a>
    <a href="#/register">注册</a>

    <router-link to="/login" tag="span">登录</router-link>
    <router-link to="/register">注册</router-link>

    <transition mode="out-in">
        <router-view></router-view>
    </transition>
</div>
<script>
    var login={
        template:'<h1>登录组件</h1>'
    }
    var register={
        template: '<h1>注册组件</h1>'
    }

    var routerobj=new VueRouter({
        routes: [
            {path:'/',redirect:'/login'},
            { path: '/login', component: login },
            { path: '/register', component: register }
        ],
        linkActiveClass:'myactive'
    })
    var vm=new Vue({
        el:"#app",
        data:{

        },
        methods:{

        },
        router:routerobj
    })
</script>
</body>
</html>